﻿@model JTWEB3.Models.Roles
@{
    ViewData["Title"] = "角色详情";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h4>@ViewData["Title"]</h4> 
<a asp-action="Index" asp-controller="Role">返回角色管理</a>
<table class="table">

    <thead>
        <tr>
            <th>ID</th>
            <td>角色名称</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>@Model.RoleId</th>
            <td>@Model.RoleName</td>
        </tr>

    </tbody>
</table>
<a asp-action="AddUser" asp-route-Id="@Model.RoleId" class=" btn btn-outline-success">添加用户</a>

@*<form method="post" asp-action="DeleteUser">
    <input type="hidden" asp-for="RoleId" />
    <input type="hidden" asp-for="RoleName" />
    <select class="form-control" asp-for="UserId" asp-items="@(new SelectList(Model.UserList,"Id","UserName"))">
        <option>--请选择一个用户--</option>
    </select>
    <hr />
    <button type="submit" class="btn btn-danger">删除用户</button>
</form>*@
<table class="table">
    <thead></thead>
    <tbody>
        @foreach (var i in Model.UserList)
        {
            <tr>
                <td>
                    @i.UserName
                </td>
                <td>
                    <form asp-action="DeleteUser" method="post">
                        <input type="hidden" asp-for="RoleName" a value="@Model.RoleName" />
                        <span asp-validation-for="RoleName"></span>

                        <input type="hidden" asp-for="RoleId" a value="@Model.RoleId" />
                        <span asp-validation-for="RoleId"></span>

                        <input type="hidden" asp-for="UserId" a value="@i.Id" />
                        <span asp-validation-for="UserId"></span>

                        <input type="submit" value="删除" class="btn btn-danger" />
                    </form>
                </td>
               
            </tr>
        }
    </tbody>
</table>
<div asp-validation-summary="All"></div>
